#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define WEIGHT  3.0e-23
#define KQ      950

static void water() {
    float num;
    float sum;

    printf("Please input for num:");
    scanf("%f", &num);
    if (num < 0) {
        fprintf(stderr, "Input error!");
        exit(1);
    }

    sum = num * KQ / WEIGHT;

    printf("total is %e\n", sum);

    return;
}

static void area(void) {

    float a, b, c;
    float s;
    float area;

    printf("Please input:");
    scanf("%f%f%f", &a, &b, &c);
    if (a + b <= c || b + c <= a || a + c <= b) {
        fprintf(stderr, "EINVAL\n");
        exit(1);
    }


    s = 1.0 / 2 * (a + b + c);
    area = sqrt(s * (s - a) * (s - b) * (s - c));

    printf("area = %f\n", area);
}

static void root() {
    float a, b, c, p, q, x1, x2;
    float disc;

    printf("Please Input:");
    scanf("%f%f%f", &a, &b, &c);

    if ((b * b - 4 * a * c) < 0) {
        fprintf(stderr, "EINVAL\n");
        exit(1);
    }

    disc = b * b - 4 * a * c;

    p = -b / 2 * a;
    q = sqrt(disc) / 2 * a;

    x1 = p + q;
    x2 = p - q;

    printf("x1 = %f\nx2=%f\n", x1, x2);
    return;
}

int main() {

    // water();

    // area();

    root();

    exit(0);
}